package com.itheima.myreflect2.Student.mapdemo1;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @program: Myset
 * @description:
 * @author: xuejingjing
 * @create: 2021-06-12 15:41
 **/
public class MyMap4 {
    public static void main(String[] args) {

        //创建集合并添加元素
        Map<String,String> map = new HashMap<>();

        map.put("1号丈夫","1号妻子");
        map.put("2号丈夫","2号妻子");
        map.put("3号丈夫","3号妻子");
        map.put("4号丈夫","4号妻子");
        map.put("5号丈夫","5号妻子");
        Set<Map.Entry<String, String>> entries = map.entrySet();

        for (Map.Entry<String, String> entry : entries) {
            System.out.println(entry.getKey()+"..."+entry.getValue());
        }

    }
}
